package com.example.test;

import cn.hutool.core.io.FileUtil;

import java.util.Locale;

/**
 * CreateFile
 *
 * @author yongxiang
 * @date 2024/9/10 10:17
 * @desc
 */
public class CreateFile {
    public static void main(String[] args) {
        //FileUtil.clean("D:\\java_project\\registry-demo-kstram\\src\\main\\resources\\avro\\A.avsc");

        String[] arr = new String[]{"A","B","C","D","E","F","G","H","I","J"};
        int f = 31;
        for (int i = f; i <= f; i++) {
            for (int j = 0; j < arr.length; j++) {
                String s = arr[j];
                FileUtil.writeString(String.format("{\n" +
                        "  \"type\": \"record\",\n" +
                        "  \"name\": \"%s%d\",\n" +
                        "  \"namespace\": \"com.example.entity.stream%d\",\n" +
                        "  \"fields\": [\n" +
                        "    {\"name\": \"id\", \"type\": \"int\"},\n" +
                        "    {\"name\": \"%s1\", \"type\": \"string\"},\n" +
                        "    {\"name\": \"%s2\", \"type\": \"string\"}\n" +
                        "  ]\n" +
                        "}", s,i,i,s.toLowerCase(Locale.ROOT),s.toLowerCase(Locale.ROOT)),String.format("D:\\java_project\\registry-demo-kstram-test\\src\\main\\resources\\avro\\%s.avsc",s),"UTF-8");
            }

            FileUtil.writeString(String.format("{\n" +
                    "  \"type\": \"record\",\n" +
                    "  \"name\": \"Source%d\",\n" +
                    "  \"namespace\": \"com.example.entity.stream%d\",\n" +
                    "  \"fields\": [\n" +
                    "    {\"name\": \"id\", \"type\": \"int\"}\n" +
                    "  ]\n" +
                    "}",i,i),"D:\\java_project\\registry-demo-kstram-test\\src\\main\\resources\\avro\\Source.avsc","UTF-8");


            FileUtil.writeString(String.format("{\n" +
                    "  \"type\": \"record\",\n" +
                    "  \"name\": \"All%d\",\n" +
                    "  \"namespace\": \"com.example.entity.stream%d\",\n" +
                    "  \"fields\": [\n" +
                    "    {\"name\": \"id\", \"type\": \"int\"},\n" +
                    "    {\"name\": \"a1\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"a2\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"b1\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"b2\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"c1\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"c2\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"d1\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"d2\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"e1\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"e2\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"f1\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"f2\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"g1\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"g2\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"h1\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"h2\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"i1\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"i2\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"j1\", \"type\": \"string\"},\n" +
                    "    {\"name\": \"j2\", \"type\": \"string\"}\n" +
                    "\n" +
                    "  ]\n" +
                    "}",i,i),"D:\\java_project\\registry-demo-kstram-test\\src\\main\\resources\\avro\\All.avsc","UTF-8");




        }

    }
}
